<template>
  <div>
    <a-card :bordered="false">
      <div>
        <a-table
          ref="table"
          :columns="columns"
          :dataSource="dataSource"
          :loading="loading"
          :pagination="ipagination"
          :scroll="{ x: 1500}"
          bordered
          rowKey="id"
          size="middle"
          @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a-button style="margin-right: 10px" type="primary" @click="handleEdit(record)">
            编辑
          </a-button>
            <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
              <a-button>
                删除
              </a-button>
            </a-popconfirm>
        </span>
        </a-table>
      </div>
    </a-card>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@api/manage'
import VarietyCarbonModal from '@views/dataVisualization/components/varietyCarbonModal'
import TrackModal from '@views/dataVisualization/components/trackModal'

export default {
  name: 'varietyCarbonEmissions',
  props: {
    dataSource: {
      type: Array,
      required: false
    }
  },
  components: { TrackModal, VarietyCarbonModal },
  mixins: [JeecgListMixin],
  data() {
    return {
      // queryParam: {
      //   month: null,
      // },
      selectList: [
        { name: '煤品', key: '煤品' },
        { name: '油品', key: '油品' },
        { name: '天然气', key: '天然气' },
        { name: '净调入电', key: '净调入电' }
      ],
      confirmLoading: false,
      title: '',
      visible: false,
      dataSource: [],
      form: this.$form.createForm(this),
      dialogStyle: {
        top: '100px'
        // right:"20px",
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      columns: [
        {
          title: '2级分类',
          dataIndex: 'level2',
          align: 'left',
          width: 150,
          fixed: true
        },
        {
          title: '3级分类',
          dataIndex: 'level3',
          align: 'left',
          width: 150,
          fixed: true
        },
        {
          title: '上游排放',
          dataIndex: 'upstreamEmissions',
          align: 'center',
          width: 100
        },
        {
          title: '上游排放单位',
          dataIndex: 'upstreamEmissionsUnit',
          align: 'left',
          width: 180
        },
        {
          title: '下游排放',
          dataIndex: 'downstreamEmissions',
          align: 'center',
          width: 100
        },
        {
          title: '下游排放单位',
          dataIndex: 'downstreamEmissionsUnit',
          align: 'left',
          width: 150
        },
        {
          title: '排放环节',
          dataIndex: 'emissionProcesses',
          align: 'left',
          width: 300
        },
        {
          title: '排放温室气体占比',
          dataIndex: 'ghgPercentage',
          align: 'center',
          width: 200
        },
        {
          title: '不确定性',
          dataIndex: 'uncertainty',
          align: 'left',
          width: 300
        },
        {
          title: '参考文献/数据来源',
          dataIndex: 'dataSource',
          align: 'left',
          width: 1000,
        },
        {
          title: '参考文献/简化',
          dataIndex: 'dataSourceShort',
          align: 'left',
          width: 300
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          width: 200,
          fixed: 'right'
        }
      ],
      url: {
        delete: '/carbon/energyAnalysisType/delete'
      }
    }
  },
  mounted() {
    console.log(this.titleNameEN)
  },
  methods: {
    openAdd() {
      this.$refs.modalForm.add()
      this.$refs.modalForm.title = '新增'
      this.$refs.modalForm.disableSubmit = false
    }
  }
}
</script>

<style scoped>

</style>